<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<table class="display" id="example">
	<thead>
		<tr>
			<th>培训课程</th>
			<th>开始日期</th>
			<th>结束日期</th>
			<th>培训对象</th>
			<th>培训类型</th>
			<th>讲师</th>
			<th>文件名</th>
			<th>上传时间</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		<s:if test="#request.plans==null || #request.plans.size<=0">
			<tr class="gradeA">
				<td colspan="9">暂无数据</td>
			</tr>
		</s:if>
		<s:else>
			<s:iterator var="plan" status="sta" value="#request.plans">
				<s:if test="#sta.even">
					<tr class="gradeA">
				</s:if>
				<s:else>
					<tr class="gradeC">
				</s:else>
				<td>${plan.title}</td>
				<td><fmt:formatDate value="${plan.trainStartDate}"
						pattern="yyyy-MM-dd hh:mm" /></td>
				<td><fmt:formatDate value="${plan.trainEndDate}"
						pattern="yyyy-MM-dd hh:mm" /></td>
				<td><span name="td_dutytarget" title="${plan.id}"></span></td>
				<td>${plan.category}</td>
				<td><s:if test="#plan.lecturerType==0">${plan.trainLecturer.employeeinfoWork.baseId.name}</s:if>
					<s:else>${plan.outingLecturer}</s:else></td>
				<td><s:if
						test="#plan.materResources != null && #plan.materResources.size > 0">
						<a
							href='<s:property value="#plan.materResources.iterator().next().coursewareUrl"/>'><s:property
								value="#plan.materResources.iterator().next().coursewareName" /></a>
					</s:if></td>
				<td><fmt:formatDate value="${plan.lastuploadDate}"
						pattern="yyyy-MM-dd hh:mm" /></td>
				<td><a class="button"
					href="#train/materresource_manage_main.xhtml?planId=${plan.id}&organizationId=${plan.organization.id}"><span
						style="background: url(${ctx}/images/img/page_add.png)"
						class="icon icon-ok">&nbsp;</span> <s:if
							test="#plan.materResources != null && #plan.materResources.size > 0">修改</s:if>
						<s:else>上传</s:else></a></td>
				</tr>
			</s:iterator>
		</s:else>
	</tbody>
</table>
<p>
	<%@ include file="/WEB-INF/pages/common/main_orgtab_pager_train_resource.jsp"%>
</p>
<script type="text/javascript">
	$(document).ready(function() {
		$("span[name='td_dutytarget']").each(function(i) {
			loadDutyTarget(this, $(this).attr("title"));
		});
	});

	function loadDutyTarget(obj, planId) {
		$.ajax({
			type : "get",
			url : "/ajax/query_dutytarget.xhtml?planId=" + planId,
			//data: "name=John&location=Boston",
			dataType : "html",
			success : function(data) {
				if (data != null) {
					$(obj).html(data);
				}
			}
		});
	}

	
</script>